package Pool;

import java.util.concurrent.LinkedBlockingQueue;

public class Customer implements Runnable{
    private LinkedBlockingQueue<BaoZi> zt;
    private String name;

    public Customer(LinkedBlockingQueue<BaoZi> zt, String name) {
        this.zt = zt;
        this.name = name;
    }

    @Override
    public void run() {
        int i=0;
        while (i<5){
            i++;
            try {
            BaoZi bz=zt.take();
            System.out.println(name+"吃了"+bz);
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
